﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Guide : MonoBehaviour {

    public GameObject guideImg;

	// Use this for initialization
	void Start () {
        StartCoroutine(IEGuide());
	}
	
	// Update is called once per frame
	void Update () {
		
	}

    IEnumerator IEGuide()
    {
        yield return new WaitForSeconds(1.5f);
        for (int i = 0; i < 2; i ++)
        {
            yield return new WaitForSeconds(0.5f);
            guideImg.SetActive(true);
            guideImg.GetComponent<TweenScale>().PlayForward();
            guideImg.GetComponent<TweenAlpha>().PlayForward();
            yield return new WaitForSeconds(0.2f);
            guideImg.GetComponent<TweenPosition>().PlayForward();
            yield return new WaitForSeconds(1);
            guideImg.GetComponent<TweenScale>().PlayReverse();
            yield return new WaitForSeconds(0.1f);
            guideImg.GetComponent<TweenAlpha>().PlayReverse();
            yield return new WaitForSeconds(0.1f);
            guideImg.SetActive(false);
            guideImg.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
            guideImg.GetComponent<Image>().color = new Color(1, 1, 1, 0);
            guideImg.GetComponent<TweenPosition>().ResetToBeginning();
        }
    }
}